<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>南方后街</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.form.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.validate.js" ></script>
<script language="javascript">
window.onload=function(){
     $("#commodityURL").val("");
  $("#release_txt").val("");
    };
$(function(){
    $("#commodityForm").validate({
    	rules: {
			commodityTitle:{
				required:true,
				rangelength:[5,30]		 
			},		
			commodityName:{
				required:true	 
			},	
			commodityPrice: {
				required: true,
				number:true
			},	
			contactPeople: {
				required: true,
				rangelength:[2,5]
			},	
			contactType: {
				required: true
			},	
			commodityExplain: {
				required: true,
				rangelength:[10,1000]
			},	
			commodityURL: {
				required: true,
				accept:true
			},	
			childCategory: {
				min:1
			},	
			commodityCondition: {
				min:1
			},	
			contactAddress: {
				min:1
			}
			
		},
		messages: {
			commodityTitle:{
				required:" * 请输入标题",
				rangelength: " * 请正确输入5-30位字符"
			} ,
			commodityName:{
				required:" * 请输入书名"
			} ,
			commodityPrice: {
				required: " * 请输入价格",
				number: " * 请输入数字（元）"
			},
			contactPeople: {
				required: " * 请正确输入联系人姓名",
				rangelength: " * 请正确输入2-5位字符"
			},
			contactType: {
				required: " * 请输入联系方式"
			},
			commodityExplain: {
				required: " * 请输入描述信息",
				rangelength: " * 请正确输入10-1000位字符"
			},
			commodityURL: {
				required: " * 请选择上传的照片",
				accept: " * 允许上传图片格式为png,jpg,gif"
			},
			childCategory: {
				min:'* 请选择'
			},
			commodityCondition: {
				min:'* 请选择'
			},
			contactAddress: {
				min:'* 请选择'
			}
		},
    	//当验证错误时候在指定的区域内显示错误提示
        errorPlacement: function (lable, element){	
             var replacement = element.parent().find("span");
             var hidden = element.parent().find("font");
             lable.appendTo(replacement);
             hidden.hide();
        },
        //当验证正确的时候删除提示内容
        success: function (replacement){
        	replacement.val("");
        	replacement.parent().find("font").show();
        },
    });
});

function clk(node){
	if(node=='commodityURL'){
	return  $("#commodityURL").click();
	}

	if(node=='release_submit'){
	return  $("#release_submit").click();
	}
}
function btnhover(dnode,img){		
	dnode.style.background ="#656565";
	if(img=='release_imghold'){
		$("#release_imghold").css('background','url(${pageContext.request.contextPath}/images/nfhoujie_icon.png) no-repeat -68px -12px');
	}
} 
function btnout(dnode,img){ 
	dnode.style.background ="#55a847";
	if(img=='release_imghold'){
		$("#release_imghold").css('background','url(${pageContext.request.contextPath}/images/nfhoujie_icon.png) no-repeat -12px -12px');
	}
}	
</script>
<!--[if IE 6]>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/DD_belatedPNG.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('#logo a,#header_holder,.menu_information,.menu_setup,.menu_loginout,#nav,.nav_book,.nav_book:hover,.nav_digital,.nav_daily,.nav_jobs');
</script>
<![endif]-->
</head>

<body>
<jsp:include page="../header.jsp" />
	
<!-- 中部 -->
<div class="release_content_holder">
	<div id="release_content">
		<!-- 发布信息栏 -->
		<div class="release_content_left" style="background-color:#fff;">
			<span id="release_left_title">发布二手页面</span>
			<form:form id="commodityForm" action="${pageContext.request.contextPath}/user/release/book" method="post" commandName="commodityForm" >
				<ul>
					<li class="overflow"><div class="release_text1 overflow">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;类&nbsp;&nbsp;别&nbsp;:</div>
						<select name="childCategory" class="release_select1">
							<option>- 请选择 -</option>
							<option value="1001">会计学系</option>
							<option value="1002">工商管理系</option>
							<option value="1003">公共管理学系</option>
							<option value="1004">外语系</option>
							<option value="1005">经管系</option>
							<option value="1006">电软系</option>
							<option value="1007">艺术系</option>
							<option value="1008">物流管理系</option>
							<option value="1009">大学英语</option>
							<option value="1010">思想政治历史</option>
							<option value="1011">研究生考试</option>
							<option value="1012">公务考试</option>
							<option value="1013">文学系</option>
						</select>	
						<font class="release_font"></font><span class="release_error"></span>
					</li>
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;标&nbsp;&nbsp;题&nbsp;:</div><input name="commodityTitle" class="release_input1" type="text"/><font class="release_font">&nbsp;&nbsp;/概括发布内容</font><span class="release_error"></span></li>
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;书&nbsp;&nbsp;名&nbsp;:</div><input name="commodityName" class="release_input1" type="text"/><font class="release_font">&nbsp;&nbsp;/请输入书籍名称</font><span class="release_error"></span></li>
					<div class="clean"></div>	
					<li class="overflow"><div class="release_text1">&nbsp;*&nbsp;&nbsp;转让价格&nbsp;:</div><input name="commodityPrice" class="release_input2" type="text"/><font class="release_font">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/请输入数字</font><span class="release_error"></span></li>					
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;*&nbsp;&nbsp;新旧程度&nbsp;:</div>
						<select name="commodityCondition" class="release_select1">
							<option>- 请选择 -</option>
							<option value="11">95成新</option>
							<option value="12">9成新</option>
							<option value="13">8成新</option>
							<option value="14">7成新及以下</option>
						</select>
						<font class="release_font"></font><span class="release_error"></span>
					</li>
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;联系人&nbsp;:</div><input name="contactPeople" class="release_input4" type="text"/><font class="release_font">&nbsp;&nbsp;&nbsp;/请输入姓名</font><span class="release_error"></span></li>
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;*&nbsp;&nbsp;联系方式&nbsp;:</div>
						<input name="contactType" class="release_input3" type="text">						
						<font class="release_font">&nbsp;&nbsp;&nbsp;/长号、短号、QQ均可</font><span class="release_error"></span>
					</li>
					<div class="clean"></div>
					<li class="overflow"><div class="release_text1">&nbsp;*&nbsp;&nbsp;所在区域&nbsp;:</div>
						<select class="release_select1" name="contactAddress">
							<option>- 请选择 -</option>
							<option value="H18">H18</option>
							<option value="H19">H19</option>
							<option value="H20">H20</option>
							<option value="H21">H21</option>
							<option value="H22">H22</option>
							<option value="H23">H23</option>
							<option value="H24">H24</option>
							<option value="H25">H25</option>
							<option value="H26">H26</option>
							<option value="H27">H27</option>
						</select>
						<font class="release_font"></font><span class="release_error"></span>
					</li>
					<div class="clean"></div>
					<li><div class="release_text1">&nbsp;*&nbsp;&nbsp;概况描述&nbsp;:</div>
						<textarea cols="54" rows="8" class="float_left" style="float:left;border: 1px solid #55a847;" name="commodityExplain"></textarea>					
						<div class="clean"></div>
						<font class="release_text2">/10-1000字以内</font><span class="release_error2"></span>
					</li>
					<div class="clean"></div>	
					<li style="margin-top:44px;"><div class="release_text1">&nbsp;*&nbsp;&nbsp;上传照片&nbsp;:</div>	
						<input type="text" id="release_txt" name="txt" onclick="clk('commodityURL')"/>
						<input type="button" class="release_file_button" style="" onclick="clk('commodityURL')" value="选择文件"/>		
						<input name="commodityURL" id="commodityURL" class="release_input_file" type="file" onchange="document.getElementById('release_txt').value=this.value" value=""/>
						<font class="release_font" style=""></font><span class="release_error"></span>	
					</li>						
					</li>						
					<div class="clean"></div>
				</ul>
				<div class="release_btnhold" onmousemove="btnhover(this,'release_imghold')" onmouseout="btnout(this,'release_imghold')" onclick="clk('release_submit')">						
					<div class="release_imghold" id="release_imghold"></div>
					<div class="release_text3">&nbsp;确认并发布</div>															
				</div>
				<input id="release_submit" type="submit" value=""/>
			</form:form>
		</div>		
		<jsp:include page="right_side.jsp" />
	</div>
</div>
	
<jsp:include page="../footer.jsp" />
</body>
</html>
